/**
 * Created by douxin on 15/7/6.
 */
var mongoose = require('mongoose');
mongoose.connect("mongodb://localhost/test");

var UserSchema = mongoose.Schema({
    username: String,
    password: String,
    realname: String
});

var UploadProjectSchema = mongoose.Schema({
    pro_name: String,
    create_time: {type: Date, default: Date.now()},
    last_update_time: Date,
    download_id: Number,
    creator: String,
    pro_type: Number,   // 0 ios, 1 android
    file_path: String,
    file_name: String,
    size: Number
});

UserSchema.method.validPassword = function(password) {
    return this.password == password;
};

var User = mongoose.model('User', UserSchema);
var UploadProject = mongoose.model('UploadProject', UploadProjectSchema);

exports.User = User;
exports.UploadProject = UploadProject;